/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2018-2021.
 * Description: support fiq_mm feature
 * Author: fanglinxu <fanglinxu@huawei.com>
 * Create: 2018-10-30
 */

#include <linux/mm.h>
#include <linux/mman.h>
#include <linux/mmzone.h>
#include <linux/swap.h>
#include <linux/vmstat.h>
#include <linux/vmalloc.h>
#include "fiq_mm.h"

#ifdef CONFIG_RTOS_KBOX
#include <linux/set_kbox_region.h>
#endif

#define FIQMM_SEQ_FILE_BUF_MAX (4 * 1024)
unsigned char fiqmm_seq_file[FIQMM_SEQ_FILE_BUF_MAX];

struct seq_file *fiqmm_seq_file_init(void)
{
	struct seq_file *p = (struct seq_file *)fiqmm_seq_file;

	memset(p, 0, sizeof(struct seq_file));
	p->private = current;
	p->buf = (char *)(p + 1);
	p->size = FIQMM_SEQ_FILE_BUF_MAX - sizeof(struct seq_file);
	return p;
}

void seq_to_kbox_print(struct seq_file *m)
{
#ifdef CONFIG_RTOS_KBOX
	int region_id = get_kbox_region();
	if (m->buf != NULL && m->count != 0)
		kbox_write(region_id, m->buf, m->count);
#endif
}

